package Views;

import Controllers.*;
import Models.*;
import java.util.HashMap;
import javax.swing.DefaultListModel;
import javax.swing.JTabbedPane;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import javax.swing.table.DefaultTableModel;

public class MainView_1 extends javax.swing.JFrame
{
	ControllerAbstract controller;
	SearchController searchController = new SearchController();
	
	Customer chosenCustomer;
	Location chosenLocation;

	public MainView_1() {
		initComponents();
		mainPane.addChangeListener(new ChangeListener() {
			public void stateChanged(ChangeEvent e) {
				JTabbedPane selectedPane = (JTabbedPane)e.getSource();
				int index = selectedPane.getSelectedIndex();
				switch(index)
				{
					case 0:
						controller = new CustomerController();
						break;
					case 1:
						controller = new LocationController();
						break;
					case 2:
						controller = new RouteController();
						break;
					case 3:
						controller = new RoundController();
						break;
					case 4:
//						controller = new EmployeeController();
						break;
					case 5:
//						controller = new ScheduleController();
						break;
					case 6:
//						controller = new InvoiceController();
						break;
				}
			}
		});
	}

	@SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        mainPane = new javax.swing.JTabbedPane();
        customerTab = new javax.swing.JPanel();
        cuInfoL = new javax.swing.JLabel();
        cuCustomerNoL = new javax.swing.JLabel();
        cuNameL = new javax.swing.JLabel();
        cuAddressL = new javax.swing.JLabel();
        cuZipCodeL = new javax.swing.JLabel();
        cuCityL = new javax.swing.JLabel();
        cuCvrL = new javax.swing.JLabel();
        cuPhoneNoL = new javax.swing.JLabel();
        cuCustomerNoTF = new javax.swing.JTextField();
        cuNameTF = new javax.swing.JTextField();
        cuAddressTF = new javax.swing.JTextField();
        cuZipCodeTF = new javax.swing.JTextField();
        cuCityTF = new javax.swing.JTextField();
        cuCvrTF = new javax.swing.JTextField();
        cuPhoneNoTF = new javax.swing.JTextField();
        cuSearchTF = new javax.swing.JTextField();
        cuSearchB = new javax.swing.JButton();
        cuListSP = new javax.swing.JScrollPane();
        cuLocationList = new javax.swing.JList();
        cuAddLocationB = new javax.swing.JButton();
        cuRemoveLocationB = new javax.swing.JButton();
        cuShowAllB = new javax.swing.JButton();
        cuNewB = new javax.swing.JButton();
        cuEditB = new javax.swing.JButton();
        cuCancelB = new javax.swing.JButton();
        cuSaveB = new javax.swing.JButton();
        cuSep1 = new javax.swing.JSeparator();
        cuSep2 = new javax.swing.JSeparator();
        cuSep3 = new javax.swing.JSeparator();
        locationTab = new javax.swing.JPanel();
        loInfoL = new javax.swing.JLabel();
        loLocationNoL = new javax.swing.JLabel();
        loAddressL = new javax.swing.JLabel();
        loZipCodeL = new javax.swing.JLabel();
        loCityL = new javax.swing.JLabel();
        loRouteNoL = new javax.swing.JLabel();
        loMapL = new javax.swing.JLabel();
        loLocationNoTF = new javax.swing.JTextField();
        loAddressTF = new javax.swing.JTextField();
        loZipCodeTF = new javax.swing.JTextField();
        loCityTF = new javax.swing.JTextField();
        loRouteNoTF = new javax.swing.JTextField();
        loListSP = new javax.swing.JScrollPane();
        loRoundList = new javax.swing.JList();
        loAddRoundB = new javax.swing.JButton();
        loRemoveRoundB = new javax.swing.JButton();
        loSearchTF = new javax.swing.JTextField();
        loSearchB = new javax.swing.JButton();
        loShowAllB = new javax.swing.JButton();
        loNewB = new javax.swing.JButton();
        loEditB = new javax.swing.JButton();
        loCancelB = new javax.swing.JButton();
        loSaveB = new javax.swing.JButton();
        loSep1 = new javax.swing.JSeparator();
        loSep2 = new javax.swing.JSeparator();
        loSep3 = new javax.swing.JSeparator();
        routeTab = new javax.swing.JPanel();
        roundTab = new javax.swing.JPanel();
        rdInfoL = new javax.swing.JLabel();
        rdRoundNoL = new javax.swing.JLabel();
        rdLocationNoL = new javax.swing.JLabel();
        rdRoundNoTF = new javax.swing.JTextField();
        rdLokationNoTF = new javax.swing.JTextField();
        rdLokationShowB = new javax.swing.JButton();
        rdSearchTF = new javax.swing.JTextField();
        rdSearchB = new javax.swing.JButton();
        rdTableSP = new javax.swing.JScrollPane();
        rdTable = new javax.swing.JTable();
        rdCoordsAddB = new javax.swing.JButton();
        rdCoordsRemoveB = new javax.swing.JButton();
        rdSep1 = new javax.swing.JSeparator();
        employeeTab = new javax.swing.JPanel();
        scheduleTab = new javax.swing.JPanel();
        jPanel1 = new javax.swing.JPanel();
        searchTab = new javax.swing.JPanel();
        seInfoL = new javax.swing.JLabel();
        seTypeL = new javax.swing.JLabel();
        seTypeCB = new javax.swing.JComboBox();
        seSearchL = new javax.swing.JLabel();
        seSearchTF = new javax.swing.JTextField();
        seSearchB = new javax.swing.JButton();
        seListSP = new javax.swing.JScrollPane();
        seResultsList = new javax.swing.JTable();
        jLabel1 = new javax.swing.JLabel();
        jTextField1 = new javax.swing.JTextField();
        jLabel2 = new javax.swing.JLabel();
        jPasswordField1 = new javax.swing.JPasswordField();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setName("Form"); // NOI18N
        setResizable(false);

        mainPane.setName("mainPane"); // NOI18N

        customerTab.setName("customerTab"); // NOI18N

        cuInfoL.setText("About...");
        cuInfoL.setName("cuInfoL"); // NOI18N

        cuCustomerNoL.setText("Kunde nr.:");
        cuCustomerNoL.setName("cuCustomerNoL"); // NOI18N

        cuNameL.setText("Navn:");
        cuNameL.setName("cuNameL"); // NOI18N

        cuAddressL.setText("Adresse:");
        cuAddressL.setName("cuAddressL"); // NOI18N

        cuZipCodeL.setText("Post nr.:");
        cuZipCodeL.setName("cuZipCodeL"); // NOI18N

        cuCityL.setText("By:");
        cuCityL.setName("cuCityL"); // NOI18N

        cuCvrL.setText("CVR:");
        cuCvrL.setName("cuCvrL"); // NOI18N

        cuPhoneNoL.setText("Tlf nr.:");
        cuPhoneNoL.setName("cuPhoneNoL"); // NOI18N

        cuCustomerNoTF.setEnabled(false);
        cuCustomerNoTF.setName("cuCustomerNoTF"); // NOI18N

        cuNameTF.setEnabled(false);
        cuNameTF.setName("cuNameTF"); // NOI18N

        cuAddressTF.setEnabled(false);
        cuAddressTF.setName("cuAddressTF"); // NOI18N

        cuZipCodeTF.setEnabled(false);
        cuZipCodeTF.setName("cuZipCodeTF"); // NOI18N

        cuCityTF.setEnabled(false);
        cuCityTF.setName("cuCityTF"); // NOI18N

        cuCvrTF.setEnabled(false);
        cuCvrTF.setName("cuCvrTF"); // NOI18N

        cuPhoneNoTF.setEnabled(false);
        cuPhoneNoTF.setName("cuPhoneNoTF"); // NOI18N

        cuSearchTF.setName("cuSearchTF"); // NOI18N

        cuSearchB.setText("Søg");
        cuSearchB.setName("cuSearchB"); // NOI18N
        cuSearchB.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cuSearchBActionPerformed(evt);
            }
        });

        cuListSP.setName("cuListSP"); // NOI18N

        cuLocationList.setEnabled(false);
        cuLocationList.setName("cuLocationList"); // NOI18N
        cuListSP.setViewportView(cuLocationList);

        cuAddLocationB.setText("Tilføj");
        cuAddLocationB.setName("cuAddLocationB"); // NOI18N

        cuRemoveLocationB.setText("Fjern");
        cuRemoveLocationB.setName("cuRemoveLocationB"); // NOI18N

        cuShowAllB.setText("Vis alle");
        cuShowAllB.setName("cuShowAllB"); // NOI18N
        cuShowAllB.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cuShowAllBActionPerformed(evt);
            }
        });

        cuNewB.setText("Ny");
        cuNewB.setName("cuNewB"); // NOI18N
        cuNewB.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cuNewBActionPerformed(evt);
            }
        });

        cuEditB.setText("Rediger");
        cuEditB.setEnabled(false);
        cuEditB.setName("cuEditB"); // NOI18N
        cuEditB.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cuEditBActionPerformed(evt);
            }
        });

        cuCancelB.setText("Annullér");
        cuCancelB.setEnabled(false);
        cuCancelB.setName("cuCancelB"); // NOI18N
        cuCancelB.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cuCancelBActionPerformed(evt);
            }
        });

        cuSaveB.setText("Gem");
        cuSaveB.setEnabled(false);
        cuSaveB.setName("cuSaveB"); // NOI18N
        cuSaveB.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cuSaveBActionPerformed(evt);
            }
        });

        cuSep1.setName("cuSep1"); // NOI18N

        cuSep2.setName("cuSep2"); // NOI18N

        cuSep3.setOrientation(javax.swing.SwingConstants.VERTICAL);
        cuSep3.setMinimumSize(new java.awt.Dimension(50, 23));
        cuSep3.setName("cuSep3"); // NOI18N
        cuSep3.setPreferredSize(new java.awt.Dimension(50, 23));

        javax.swing.GroupLayout customerTabLayout = new javax.swing.GroupLayout(customerTab);
        customerTab.setLayout(customerTabLayout);
        customerTabLayout.setHorizontalGroup(
            customerTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(customerTabLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(customerTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, customerTabLayout.createSequentialGroup()
                        .addGroup(customerTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(customerTabLayout.createSequentialGroup()
                                .addGroup(customerTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(cuCustomerNoL)
                                    .addComponent(cuNameL)
                                    .addComponent(cuAddressL)
                                    .addComponent(cuZipCodeL)
                                    .addComponent(cuCityL)
                                    .addComponent(cuCvrL)
                                    .addComponent(cuPhoneNoL))
                                .addGap(6, 6, 6)
                                .addGroup(customerTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(cuPhoneNoTF, javax.swing.GroupLayout.PREFERRED_SIZE, 150, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(cuCvrTF, javax.swing.GroupLayout.PREFERRED_SIZE, 150, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(cuCityTF, javax.swing.GroupLayout.PREFERRED_SIZE, 150, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(cuZipCodeTF, javax.swing.GroupLayout.PREFERRED_SIZE, 150, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(cuAddressTF, javax.swing.GroupLayout.PREFERRED_SIZE, 150, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(cuNameTF, javax.swing.GroupLayout.PREFERRED_SIZE, 150, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(cuCustomerNoTF, javax.swing.GroupLayout.PREFERRED_SIZE, 150, javax.swing.GroupLayout.PREFERRED_SIZE)))
                            .addComponent(cuInfoL))
                        .addGap(18, 18, 18)
                        .addGroup(customerTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(cuSep1, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 265, Short.MAX_VALUE)
                            .addGroup(customerTabLayout.createSequentialGroup()
                                .addComponent(cuSearchTF, javax.swing.GroupLayout.DEFAULT_SIZE, 204, Short.MAX_VALUE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(cuSearchB))
                            .addGroup(customerTabLayout.createSequentialGroup()
                                .addComponent(cuListSP, javax.swing.GroupLayout.DEFAULT_SIZE, 202, Short.MAX_VALUE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addGroup(customerTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                    .addComponent(cuAddLocationB)
                                    .addComponent(cuRemoveLocationB)))))
                    .addComponent(cuSep2, javax.swing.GroupLayout.DEFAULT_SIZE, 490, Short.MAX_VALUE)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, customerTabLayout.createSequentialGroup()
                        .addComponent(cuShowAllB)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(cuSep3, javax.swing.GroupLayout.PREFERRED_SIZE, 5, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(cuNewB)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(cuEditB)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 158, Short.MAX_VALUE)
                        .addComponent(cuCancelB)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(cuSaveB)))
                .addContainerGap())
        );
        customerTabLayout.setVerticalGroup(
            customerTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(customerTabLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(customerTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(customerTabLayout.createSequentialGroup()
                        .addComponent(cuInfoL)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(customerTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(cuCustomerNoL)
                            .addComponent(cuCustomerNoTF, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(customerTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(cuNameL)
                            .addComponent(cuNameTF, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(customerTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(cuAddressL)
                            .addComponent(cuAddressTF, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(11, 11, 11)
                        .addGroup(customerTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(cuZipCodeL)
                            .addComponent(cuZipCodeTF, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(customerTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(cuCityL)
                            .addComponent(cuCityTF, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(customerTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(cuCvrL)
                            .addComponent(cuCvrTF, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(customerTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(cuPhoneNoL)
                            .addComponent(cuPhoneNoTF, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addGroup(customerTabLayout.createSequentialGroup()
                        .addGroup(customerTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(cuSearchTF, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(cuSearchB))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(cuSep1, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(customerTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(customerTabLayout.createSequentialGroup()
                                .addComponent(cuAddLocationB)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(cuRemoveLocationB))
                            .addComponent(cuListSP, javax.swing.GroupLayout.PREFERRED_SIZE, 204, javax.swing.GroupLayout.PREFERRED_SIZE))))
                .addGap(11, 11, 11)
                .addComponent(cuSep2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(customerTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(customerTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(customerTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(cuEditB)
                            .addComponent(cuNewB)
                            .addComponent(cuSaveB)
                            .addComponent(cuCancelB))
                        .addComponent(cuSep3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(cuShowAllB))
                .addContainerGap())
        );

        mainPane.addTab("Kunder", customerTab);

        locationTab.setName("locationTab"); // NOI18N

        loInfoL.setText("About...");
        loInfoL.setName("loInfoL"); // NOI18N

        loLocationNoL.setText("Lokations nr.:");
        loLocationNoL.setName("loLocationNoL"); // NOI18N

        loAddressL.setText("Adresse:");
        loAddressL.setName("loAddressL"); // NOI18N

        loZipCodeL.setText("Post nr.:");
        loZipCodeL.setName("loZipCodeL"); // NOI18N

        loCityL.setText("By:");
        loCityL.setName("loCityL"); // NOI18N

        loRouteNoL.setText("Rute nr.:");
        loRouteNoL.setName("loRouteNoL"); // NOI18N

        loMapL.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Views/1.JPG"))); // NOI18N
        loMapL.setName("loMapL"); // NOI18N

        loLocationNoTF.setEnabled(false);
        loLocationNoTF.setName("loLocationNoTF"); // NOI18N

        loAddressTF.setEnabled(false);
        loAddressTF.setName("loAddressTF"); // NOI18N

        loZipCodeTF.setEnabled(false);
        loZipCodeTF.setName("loZipCodeTF"); // NOI18N

        loCityTF.setEnabled(false);
        loCityTF.setName("loCityTF"); // NOI18N

        loRouteNoTF.setEnabled(false);
        loRouteNoTF.setName("loRouteNoTF"); // NOI18N

        loListSP.setName("loListSP"); // NOI18N

        loRoundList.setEnabled(false);
        loRoundList.setName("loRoundList"); // NOI18N
        loListSP.setViewportView(loRoundList);

        loAddRoundB.setText("Tilføj");
        loAddRoundB.setName("loAddRoundB"); // NOI18N

        loRemoveRoundB.setText("Fjern");
        loRemoveRoundB.setName("loRemoveRoundB"); // NOI18N

        loSearchTF.setName("loSearchTF"); // NOI18N

        loSearchB.setText("Søg");
        loSearchB.setName("loSearchB"); // NOI18N
        loSearchB.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                loSearchBActionPerformed(evt);
            }
        });

        loShowAllB.setText("Vis alle");
        loShowAllB.setName("loShowAllB"); // NOI18N
        loShowAllB.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                loShowAllBActionPerformed(evt);
            }
        });

        loNewB.setText("Ny");
        loNewB.setName("loNewB"); // NOI18N
        loNewB.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                loNewBActionPerformed(evt);
            }
        });

        loEditB.setText("Rediger");
        loEditB.setEnabled(false);
        loEditB.setName("loEditB"); // NOI18N
        loEditB.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                loEditBActionPerformed(evt);
            }
        });

        loCancelB.setText("Annullér");
        loCancelB.setEnabled(false);
        loCancelB.setName("loCancelB"); // NOI18N
        loCancelB.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                loCancelBActionPerformed(evt);
            }
        });

        loSaveB.setText("Gem");
        loSaveB.setEnabled(false);
        loSaveB.setName("loSaveB"); // NOI18N
        loSaveB.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                loSaveBActionPerformed(evt);
            }
        });

        loSep1.setName("loSep1"); // NOI18N

        loSep2.setName("loSep2"); // NOI18N

        loSep3.setOrientation(javax.swing.SwingConstants.VERTICAL);
        loSep3.setMinimumSize(new java.awt.Dimension(50, 23));
        loSep3.setName("loSep3"); // NOI18N
        loSep3.setPreferredSize(new java.awt.Dimension(50, 23));

        javax.swing.GroupLayout locationTabLayout = new javax.swing.GroupLayout(locationTab);
        locationTab.setLayout(locationTabLayout);
        locationTabLayout.setHorizontalGroup(
            locationTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(locationTabLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(locationTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(loSep2, javax.swing.GroupLayout.PREFERRED_SIZE, 473, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(locationTabLayout.createSequentialGroup()
                        .addComponent(loShowAllB)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(loSep3, javax.swing.GroupLayout.PREFERRED_SIZE, 5, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(loNewB)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(loEditB)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 158, Short.MAX_VALUE)
                        .addComponent(loCancelB)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(loSaveB))
                    .addGroup(locationTabLayout.createSequentialGroup()
                        .addGroup(locationTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(locationTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, locationTabLayout.createSequentialGroup()
                                    .addGroup(locationTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                        .addComponent(loLocationNoL)
                                        .addComponent(loAddressL)
                                        .addComponent(loZipCodeL)
                                        .addComponent(loCityL)
                                        .addComponent(loRouteNoL))
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addGroup(locationTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                        .addComponent(loRouteNoTF, javax.swing.GroupLayout.PREFERRED_SIZE, 150, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addComponent(loCityTF, javax.swing.GroupLayout.PREFERRED_SIZE, 150, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addComponent(loZipCodeTF, javax.swing.GroupLayout.PREFERRED_SIZE, 150, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addComponent(loAddressTF, javax.swing.GroupLayout.PREFERRED_SIZE, 150, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addComponent(loLocationNoTF, javax.swing.GroupLayout.PREFERRED_SIZE, 150, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, locationTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                            .addComponent(loAddRoundB)
                                            .addComponent(loRemoveRoundB)))
                                    .addGap(26, 26, 26))
                                .addGroup(locationTabLayout.createSequentialGroup()
                                    .addComponent(loInfoL)
                                    .addGap(207, 207, 207)))
                            .addComponent(loListSP, javax.swing.GroupLayout.PREFERRED_SIZE, 157, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(locationTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(loMapL)
                            .addGroup(locationTabLayout.createSequentialGroup()
                                .addComponent(loSearchTF, javax.swing.GroupLayout.DEFAULT_SIZE, 185, Short.MAX_VALUE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(loSearchB))
                            .addComponent(loSep1, javax.swing.GroupLayout.DEFAULT_SIZE, 242, Short.MAX_VALUE))))
                .addContainerGap())
        );
        locationTabLayout.setVerticalGroup(
            locationTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(locationTabLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(locationTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(loInfoL)
                    .addComponent(loSearchB)
                    .addComponent(loSearchTF, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(locationTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(locationTabLayout.createSequentialGroup()
                        .addGroup(locationTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(loLocationNoL)
                            .addComponent(loLocationNoTF, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(locationTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(loAddressL)
                            .addComponent(loAddressTF, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(locationTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(loZipCodeL)
                            .addComponent(loZipCodeTF, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(locationTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(loCityL)
                            .addComponent(loCityTF, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(locationTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(loRouteNoL)
                            .addComponent(loRouteNoTF, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(locationTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(locationTabLayout.createSequentialGroup()
                                .addComponent(loAddRoundB)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(loRemoveRoundB))
                            .addComponent(loListSP, javax.swing.GroupLayout.PREFERRED_SIZE, 65, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addGroup(locationTabLayout.createSequentialGroup()
                        .addComponent(loSep1, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(loMapL)))
                .addGap(11, 11, 11)
                .addComponent(loSep2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(locationTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(locationTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(loNewB)
                        .addComponent(loEditB)
                        .addComponent(loSaveB)
                        .addComponent(loCancelB))
                    .addComponent(loSep3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(loShowAllB))
                .addContainerGap())
        );

        mainPane.addTab("Lokationer", locationTab);

        routeTab.setName("routeTab"); // NOI18N

        javax.swing.GroupLayout routeTabLayout = new javax.swing.GroupLayout(routeTab);
        routeTab.setLayout(routeTabLayout);
        routeTabLayout.setHorizontalGroup(
            routeTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 510, Short.MAX_VALUE)
        );
        routeTabLayout.setVerticalGroup(
            routeTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 313, Short.MAX_VALUE)
        );

        mainPane.addTab("Ruter", routeTab);

        roundTab.setName("roundTab"); // NOI18N

        rdInfoL.setText("About...");
        rdInfoL.setName("rdInfoL"); // NOI18N

        rdRoundNoL.setText("Runde nr.:");
        rdRoundNoL.setName("rdRoundNoL"); // NOI18N

        rdLocationNoL.setText("Lokations nr.:");
        rdLocationNoL.setName("rdLocationNoL"); // NOI18N

        rdRoundNoTF.setName("rdRoundNoTF"); // NOI18N

        rdLokationNoTF.setName("rdLokationNoTF"); // NOI18N

        rdLokationShowB.setText("Vis");
        rdLokationShowB.setName("rdLokationShowB"); // NOI18N

        rdSearchTF.setName("rdSearchTF"); // NOI18N

        rdSearchB.setText("Søg");
        rdSearchB.setName("rdSearchB"); // NOI18N
        rdSearchB.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                rdSearchBActionPerformed(evt);
            }
        });

        rdTableSP.setName("rdTableSP"); // NOI18N

        rdTable.setModel(new DefaultTableModel());
        rdTable.setName("rdTable"); // NOI18N
        rdTableSP.setViewportView(rdTable);

        rdCoordsAddB.setText("Tilføj");
        rdCoordsAddB.setName("rdCoordsAddB"); // NOI18N

        rdCoordsRemoveB.setText("Fjern");
        rdCoordsRemoveB.setName("rdCoordsRemoveB"); // NOI18N

        rdSep1.setName("rdSep1"); // NOI18N

        javax.swing.GroupLayout roundTabLayout = new javax.swing.GroupLayout(roundTab);
        roundTab.setLayout(roundTabLayout);
        roundTabLayout.setHorizontalGroup(
            roundTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(roundTabLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(roundTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(rdInfoL)
                    .addGroup(roundTabLayout.createSequentialGroup()
                        .addGroup(roundTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(rdRoundNoL)
                            .addComponent(rdLocationNoL))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(roundTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(roundTabLayout.createSequentialGroup()
                                .addComponent(rdLokationNoTF, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(rdLokationShowB))
                            .addComponent(rdRoundNoTF, javax.swing.GroupLayout.PREFERRED_SIZE, 150, javax.swing.GroupLayout.PREFERRED_SIZE))))
                .addGap(30, 30, 30)
                .addGroup(roundTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(roundTabLayout.createSequentialGroup()
                        .addComponent(rdSearchTF, javax.swing.GroupLayout.DEFAULT_SIZE, 182, Short.MAX_VALUE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(rdSearchB))
                    .addComponent(rdSep1, javax.swing.GroupLayout.DEFAULT_SIZE, 239, Short.MAX_VALUE)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, roundTabLayout.createSequentialGroup()
                        .addComponent(rdTableSP, javax.swing.GroupLayout.DEFAULT_SIZE, 176, Short.MAX_VALUE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(roundTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(rdCoordsAddB)
                            .addComponent(rdCoordsRemoveB))))
                .addContainerGap())
        );
        roundTabLayout.setVerticalGroup(
            roundTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(roundTabLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(roundTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(rdSearchB)
                    .addComponent(rdSearchTF, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(rdInfoL))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(roundTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(roundTabLayout.createSequentialGroup()
                        .addComponent(rdSep1, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(roundTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(roundTabLayout.createSequentialGroup()
                                .addComponent(rdCoordsAddB)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(rdCoordsRemoveB))
                            .addComponent(rdTableSP, javax.swing.GroupLayout.PREFERRED_SIZE, 140, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addGroup(roundTabLayout.createSequentialGroup()
                        .addGroup(roundTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(rdRoundNoL)
                            .addComponent(rdRoundNoTF, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(roundTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(rdLocationNoL)
                            .addComponent(rdLokationNoTF, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(rdLokationShowB))))
                .addContainerGap(117, Short.MAX_VALUE))
        );

        mainPane.addTab("Runder", roundTab);

        employeeTab.setName("employeeTab"); // NOI18N

        javax.swing.GroupLayout employeeTabLayout = new javax.swing.GroupLayout(employeeTab);
        employeeTab.setLayout(employeeTabLayout);
        employeeTabLayout.setHorizontalGroup(
            employeeTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 510, Short.MAX_VALUE)
        );
        employeeTabLayout.setVerticalGroup(
            employeeTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 313, Short.MAX_VALUE)
        );

        mainPane.addTab("Ansatte", employeeTab);

        scheduleTab.setName("scheduleTab"); // NOI18N

        javax.swing.GroupLayout scheduleTabLayout = new javax.swing.GroupLayout(scheduleTab);
        scheduleTab.setLayout(scheduleTabLayout);
        scheduleTabLayout.setHorizontalGroup(
            scheduleTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 510, Short.MAX_VALUE)
        );
        scheduleTabLayout.setVerticalGroup(
            scheduleTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 313, Short.MAX_VALUE)
        );

        mainPane.addTab("Vagtplaner", scheduleTab);

        jPanel1.setName("jPanel1"); // NOI18N

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 510, Short.MAX_VALUE)
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 313, Short.MAX_VALUE)
        );

        mainPane.addTab("Fakturaer", jPanel1);

        searchTab.setName("searchTab"); // NOI18N

        seInfoL.setText("About...");
        seInfoL.setName("seInfoL"); // NOI18N

        seTypeL.setText("Class:");
        seTypeL.setName("seTypeL"); // NOI18N

        seTypeCB.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Kunder", "Lokationer", "Ruter", "Ansatte", "Vagtplaner" }));
        seTypeCB.setName("seTypeCB"); // NOI18N

        seSearchL.setText("Search:");
        seSearchL.setName("seSearchL"); // NOI18N

        seSearchTF.setName("seSearchTF"); // NOI18N

        seSearchB.setText("Go!");
        seSearchB.setName("seSearchB"); // NOI18N
        seSearchB.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                seSearchBActionPerformed(evt);
            }
        });

        seListSP.setName("seListSP"); // NOI18N

        seResultsList.setModel(new DefaultTableModel());
        seResultsList.setColumnSelectionAllowed(true);
        seResultsList.setName("seResultsList"); // NOI18N
        seResultsList.getTableHeader().setReorderingAllowed(false);
        seListSP.setViewportView(seResultsList);
        seResultsList.getColumnModel().getSelectionModel().setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);

        javax.swing.GroupLayout searchTabLayout = new javax.swing.GroupLayout(searchTab);
        searchTab.setLayout(searchTabLayout);
        searchTabLayout.setHorizontalGroup(
            searchTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(searchTabLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(searchTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(seListSP, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(seInfoL)
                    .addGroup(searchTabLayout.createSequentialGroup()
                        .addGroup(searchTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(seSearchL)
                            .addComponent(seTypeL))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(searchTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(seTypeCB, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(seSearchTF, javax.swing.GroupLayout.PREFERRED_SIZE, 103, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(seSearchB)))
                .addContainerGap(48, Short.MAX_VALUE))
        );
        searchTabLayout.setVerticalGroup(
            searchTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(searchTabLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(seInfoL)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(searchTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(seTypeL)
                    .addComponent(seTypeCB, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(searchTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(seSearchL)
                    .addComponent(seSearchTF, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(seSearchB))
                .addGap(18, 18, 18)
                .addComponent(seListSP, javax.swing.GroupLayout.PREFERRED_SIZE, 204, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        mainPane.addTab("Søgning", searchTab);

        jLabel1.setText("Login:");
        jLabel1.setName("jLabel1"); // NOI18N

        jTextField1.setName("jTextField1"); // NOI18N

        jLabel2.setText("Password:");
        jLabel2.setName("jLabel2"); // NOI18N

        jPasswordField1.setName("jPasswordField1"); // NOI18N

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(mainPane, javax.swing.GroupLayout.DEFAULT_SIZE, 515, Short.MAX_VALUE)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(jLabel1)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, 97, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jLabel2)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jPasswordField1, javax.swing.GroupLayout.PREFERRED_SIZE, 106, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel1)
                    .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel2)
                    .addComponent(jPasswordField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addComponent(mainPane, javax.swing.GroupLayout.PREFERRED_SIZE, 341, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void cuNewBActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cuNewBActionPerformed
		cuClearComponents();
		cuChangeComponentState(true);
		cuEditB.setEnabled(false);
    }//GEN-LAST:event_cuNewBActionPerformed

	private void cuEditBActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cuEditBActionPerformed
		cuChangeComponentState(true);
		cuNewB.setEnabled(true);
		cuEditB.setEnabled(false);
	}//GEN-LAST:event_cuEditBActionPerformed

	private void cuSaveBActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cuSaveBActionPerformed
		HashMap data = new HashMap();
		data.put("name", this.cuNameTF.getText());
		data.put("address", this.cuAddressTF.getText());
		data.put("cvr", Integer.parseInt(this.cuCvrTF.getText()));
		data.put("zipCode", Integer.parseInt(this.cuZipCodeTF.getText()));
		data.put("phoneNo", Integer.parseInt(this.cuPhoneNoTF.getText()));
		
		if(chosenCustomer == null)
		{
			controller.insert(data);
		}
		else
		{
			controller.update(data, "customerNo = "+chosenCustomer.getCustomerNo(), 1);
		}
		
		cuClearComponents();
		cuChangeComponentState(false);
	}//GEN-LAST:event_cuSaveBActionPerformed

	private void cuCancelBActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cuCancelBActionPerformed
		cuClearComponents();
		cuChangeComponentState(false);
	}//GEN-LAST:event_cuCancelBActionPerformed

	private void seSearchBActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_seSearchBActionPerformed
		String searchText = seSearchTF.getText();
		switch(seTypeCB.getSelectedIndex())
		{
			case 0: //Customers
				seResultsList.setModel(new CustomerTableModel(searchController.searchCustomer(searchText)));
				break;
			case 1: //Locations
				seResultsList.setModel(new LocationTableModel(searchController.searchLocation(searchText)));
				break;
			case 2: //Routes
				seResultsList.setModel(new RouteTableModel(searchController.searchRoute(searchText)));
				break;
			case 3: //Rounds
				seResultsList.setModel(new RoundTableModel(searchController.searchRound(searchText)));
				break;
			case 4: //Employees
//				controller = new EmployeeController();
				break;
			case 5: //Schedules
//				controller = new ScheduleController();
				break;
			case 6: //Invoices
//				controller = new InvoiceController();
				break;
		}
	}//GEN-LAST:event_seSearchBActionPerformed

	private void cuSearchBActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cuSearchBActionPerformed
		mainPane.setSelectedIndex(7);
		seTypeCB.setSelectedIndex(0);
		seSearchTF.setText(cuSearchTF.getText());
		seSearchBActionPerformed(null);
	}//GEN-LAST:event_cuSearchBActionPerformed

	private void cuShowAllBActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cuShowAllBActionPerformed
		seResultsList.setModel(new CustomerTableModel(controller.fetchAll()));
	}//GEN-LAST:event_cuShowAllBActionPerformed

	private void loShowAllBActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_loShowAllBActionPerformed
		// TODO add your handling code here:
}//GEN-LAST:event_loShowAllBActionPerformed

	private void loNewBActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_loNewBActionPerformed
		loClearComponents();
		loChangeComponentState(true);
		loEditB.setEnabled(false);
}//GEN-LAST:event_loNewBActionPerformed

	private void loEditBActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_loEditBActionPerformed
		loChangeComponentState(true);
		loNewB.setEnabled(true);
		loEditB.setEnabled(false);
}//GEN-LAST:event_loEditBActionPerformed

	private void loSaveBActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_loSaveBActionPerformed
		HashMap data = new HashMap();
		data.put("address", this.loAddressTF.getText());
		data.put("zipCode", Integer.parseInt(this.loZipCodeTF.getText()));
		data.put("routeNo", Integer.parseInt(this.loRouteNoTF.getText()));

		if(chosenLocation == null)
		{
			controller.insert(data);
		}
		else
		{
			controller.update(data, "locationNo = "+chosenLocation.getLocationNo(), 1);
		}

		loClearComponents();
		loChangeComponentState(false);
}//GEN-LAST:event_loSaveBActionPerformed

	private void loCancelBActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_loCancelBActionPerformed
		loClearComponents();
		loChangeComponentState(false);
}//GEN-LAST:event_loCancelBActionPerformed

	private void loSearchBActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_loSearchBActionPerformed
		mainPane.setSelectedIndex(7);
		seTypeCB.setSelectedIndex(1);
		seSearchTF.setText(loSearchTF.getText());
		seSearchBActionPerformed(null);
}//GEN-LAST:event_loSearchBActionPerformed

	private void rdSearchBActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_rdSearchBActionPerformed
		// TODO add your handling code here:
}//GEN-LAST:event_rdSearchBActionPerformed

	private void cuChangeComponentState(boolean state)
	{
		cuNameTF.setEnabled(state);
		cuAddressTF.setEnabled(state);
		cuZipCodeTF.setEnabled(state);
		cuCvrTF.setEnabled(state);
		cuPhoneNoTF.setEnabled(state);
		cuLocationList.setEnabled(state);
		cuCancelB.setEnabled(state);
		cuSaveB.setEnabled(state);
	}

	private void cuPopulateFields()
	{
		cuCustomerNoTF.setText(String.valueOf(this.chosenCustomer.getCustomerNo()));
		cuNameTF.setText(String.valueOf(this.chosenCustomer.getName()));
		cuAddressTF.setText(this.chosenCustomer.getAddress());
		cuCvrTF.setText(String.valueOf(this.chosenCustomer.getCvr()));
		cuZipCodeTF.setText(String.valueOf(this.chosenCustomer.getZipCode()));
		cuCityTF.setText(this.chosenCustomer.getCity());
		cuPhoneNoTF.setText(String.valueOf(this.chosenCustomer.getPhoneNo()));
		cuLocationList.setModel(new DefaultListModel()); //TODO!
		cuNewB.setEnabled(true);
		cuEditB.setEnabled(true);
	}

	private void cuClearComponents()
	{
		chosenCustomer = null;
		cuNameTF.setText("");
		cuAddressTF.setText("");
		cuZipCodeTF.setText("");
		cuCvrTF.setText("");
		cuPhoneNoTF.setText("");
		cuLocationList.setModel(new DefaultListModel());
		cuNewB.setEnabled(true);
		cuEditB.setEnabled(false);
	}

	private void loChangeComponentState(boolean state)
	{
		loAddressTF.setEnabled(state);
		loZipCodeTF.setEnabled(state);
		loRouteNoTF.setEnabled(state);
		loRoundList.setEnabled(state);
		loCancelB.setEnabled(state);
		loSaveB.setEnabled(state);
	}

	private void loPopulateFields()
	{
		loLocationNoTF.setText(String.valueOf(this.chosenLocation.getLocationNo()));
		loAddressTF.setText(this.chosenLocation.getAddress());
		loZipCodeTF.setText(String.valueOf(this.chosenLocation.getZipCode()));
		loCityTF.setText(this.chosenLocation.getCity());
		loRouteNoTF.setText(String.valueOf(this.chosenLocation.getRouteNo()));
		loRoundList.setModel(new DefaultListModel()); //TODO!
		loNewB.setEnabled(true);
		loEditB.setEnabled(true);
	}

	private void loClearComponents()
	{
		chosenLocation = null;
		loLocationNoTF.setText("");
		loAddressTF.setText("");
		loZipCodeTF.setText("");
		loCityTF.setText("");
		loRouteNoTF.setText("");
		loRoundList.setModel(new DefaultListModel()); //TODO!
		loNewB.setEnabled(true);
		loEditB.setEnabled(false);
	}

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton cuAddLocationB;
    private javax.swing.JLabel cuAddressL;
    private javax.swing.JTextField cuAddressTF;
    private javax.swing.JButton cuCancelB;
    private javax.swing.JLabel cuCityL;
    private javax.swing.JTextField cuCityTF;
    private javax.swing.JLabel cuCustomerNoL;
    private javax.swing.JTextField cuCustomerNoTF;
    private javax.swing.JLabel cuCvrL;
    private javax.swing.JTextField cuCvrTF;
    private javax.swing.JButton cuEditB;
    private javax.swing.JLabel cuInfoL;
    private javax.swing.JScrollPane cuListSP;
    private javax.swing.JList cuLocationList;
    private javax.swing.JLabel cuNameL;
    private javax.swing.JTextField cuNameTF;
    private javax.swing.JButton cuNewB;
    private javax.swing.JLabel cuPhoneNoL;
    private javax.swing.JTextField cuPhoneNoTF;
    private javax.swing.JButton cuRemoveLocationB;
    private javax.swing.JButton cuSaveB;
    private javax.swing.JButton cuSearchB;
    private javax.swing.JTextField cuSearchTF;
    private javax.swing.JSeparator cuSep1;
    private javax.swing.JSeparator cuSep2;
    private javax.swing.JSeparator cuSep3;
    private javax.swing.JButton cuShowAllB;
    private javax.swing.JLabel cuZipCodeL;
    private javax.swing.JTextField cuZipCodeTF;
    private javax.swing.JPanel customerTab;
    private javax.swing.JPanel employeeTab;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPasswordField jPasswordField1;
    private javax.swing.JTextField jTextField1;
    private javax.swing.JButton loAddRoundB;
    private javax.swing.JLabel loAddressL;
    private javax.swing.JTextField loAddressTF;
    private javax.swing.JButton loCancelB;
    private javax.swing.JLabel loCityL;
    private javax.swing.JTextField loCityTF;
    private javax.swing.JButton loEditB;
    private javax.swing.JLabel loInfoL;
    private javax.swing.JScrollPane loListSP;
    private javax.swing.JLabel loLocationNoL;
    private javax.swing.JTextField loLocationNoTF;
    private javax.swing.JLabel loMapL;
    private javax.swing.JButton loNewB;
    private javax.swing.JButton loRemoveRoundB;
    private javax.swing.JList loRoundList;
    private javax.swing.JLabel loRouteNoL;
    private javax.swing.JTextField loRouteNoTF;
    private javax.swing.JButton loSaveB;
    private javax.swing.JButton loSearchB;
    private javax.swing.JTextField loSearchTF;
    private javax.swing.JSeparator loSep1;
    private javax.swing.JSeparator loSep2;
    private javax.swing.JSeparator loSep3;
    private javax.swing.JButton loShowAllB;
    private javax.swing.JLabel loZipCodeL;
    private javax.swing.JTextField loZipCodeTF;
    private javax.swing.JPanel locationTab;
    private javax.swing.JTabbedPane mainPane;
    private javax.swing.JButton rdCoordsAddB;
    private javax.swing.JButton rdCoordsRemoveB;
    private javax.swing.JLabel rdInfoL;
    private javax.swing.JLabel rdLocationNoL;
    private javax.swing.JTextField rdLokationNoTF;
    private javax.swing.JButton rdLokationShowB;
    private javax.swing.JLabel rdRoundNoL;
    private javax.swing.JTextField rdRoundNoTF;
    private javax.swing.JButton rdSearchB;
    private javax.swing.JTextField rdSearchTF;
    private javax.swing.JSeparator rdSep1;
    private javax.swing.JTable rdTable;
    private javax.swing.JScrollPane rdTableSP;
    private javax.swing.JPanel roundTab;
    private javax.swing.JPanel routeTab;
    private javax.swing.JPanel scheduleTab;
    private javax.swing.JLabel seInfoL;
    private javax.swing.JScrollPane seListSP;
    private javax.swing.JTable seResultsList;
    private javax.swing.JButton seSearchB;
    private javax.swing.JLabel seSearchL;
    private javax.swing.JTextField seSearchTF;
    private javax.swing.JComboBox seTypeCB;
    private javax.swing.JLabel seTypeL;
    private javax.swing.JPanel searchTab;
    // End of variables declaration//GEN-END:variables
}